import Router from 'koa-router'
import userController from '@/controller/user.controller'
import { verifyUser, handlePassword } from '@/middleware/user.middeware'
import { vertifyAuth } from '@/middleware/auth.middleware'


const userRouter: Router = new Router({prefix: '/users'})
/**
 * 创建用户
 */
userRouter.post('/register', verifyUser, handlePassword, userController.create)

/**
 * 用户关联角色
 */
userRouter.post('/addRole', vertifyAuth, userController.addRole)

/**
 * 查询用户菜单
 */
userRouter.get('/getMenu', vertifyAuth, userController.getMenu)

/**
 * 查询用户列表
 */
userRouter.get('/list', vertifyAuth, userController.getList)

export default userRouter